<?php
/*
 * name: gsl
 * desc: 系统设置 迁移表
 * date: 2018/09/21
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateOperateLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('operate_log', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->integer('user_id')->comment('用户id');
            $table->string('path', 255)->comment('操作路由地址');
            $table->text('method')->comment('访问方式,如GET/POST');
            $table->string('ip',15)->comment('客户端ip');
            $table->string('input',255)->nullable()->comment('访问参数,json格式');
            $table->timestamps();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."operate_log` comment'系统操作日志'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('operate_log');
    }
}
